﻿-- Define the relationship between Mark and Person
ALTER TABLE [dbo].[Mark] WITH CHECK ADD  
       CONSTRAINT [FK_Mark_CreatedByPerson] FOREIGN KEY([CreatedBy])
REFERENCES [dbo].[Person] ([PersonId])
ON DELETE NO ACTION
GO
-- Define the relationship between Mark and Participant
ALTER TABLE [dbo].[Mark] WITH CHECK ADD  
       CONSTRAINT [FK_Participant_Participant] FOREIGN KEY([ResponsibleParticipant])
REFERENCES [dbo].[Participant] ([ParticipantId])
ON DELETE NO ACTION
GO
-- Define the relationship between Mark and Participant
ALTER TABLE [dbo].[Mark] WITH CHECK ADD  
       CONSTRAINT [FK_Mark_NextParticipant] FOREIGN KEY([NextParticipant])
REFERENCES [dbo].[Participant] ([ParticipantId])
ON DELETE NO ACTION
GO
-- Define the relationship between Mark and Model
ALTER TABLE [dbo].[Mark] WITH CHECK ADD  
       CONSTRAINT [FK_Mark_Model] FOREIGN KEY([Model])
REFERENCES [dbo].[Model] ([ModelId])
ON DELETE NO ACTION
GO
-- Define the relationship between Mark and Person
ALTER TABLE [dbo].[Mark] WITH CHECK ADD  
       CONSTRAINT [FK_Mark_LastChangedBy] FOREIGN KEY([LastChangedBy])
REFERENCES [dbo].[Person] ([PersonId])
ON DELETE NO ACTION
GO
-- Define the relationship between Mark and Activity
ALTER TABLE [dbo].[Mark] WITH CHECK ADD  
       CONSTRAINT [FK_Mark_Activity] FOREIGN KEY([Activity])
REFERENCES [dbo].[Activity] ([ActivityId])
ON DELETE NO ACTION
GO